include constants.mk helpers.mk

all: \
	debug \
	create_directories \
	build_deps \
	bot \
	prepare_data

create_directories: $(build_dir)

$(build_dir):
	@$(call print_info, "creating build directory")
	@mkdir -p $(build_dir)

build_deps:
	$(MAKE) -C $(dep_src_dir)

bot:
	$(MAKE) -C $(src_dir)

bot_clean:
	$(MAKE) -C $(src_dir) clean

test:
	$(MAKE) -C $(src_dir) lib
	$(MAKE) -C $(test_dir) test_suite=$(test_suite)

test_clean:
	$(MAKE) -C $(test_dir) clean

prepare_data:
	$(MAKE) -C $(data_dir)

debug:
ifdef debug
	@$(call print_info, "building in debug mode")
endif

.PHONY: clean

clean:
	rm -fR $(build_dir)

help:
	@$(call print_info, "available commands:")
	@$(call print_help,'[<targetname>] [debug=true|1]','enable debug option')
	@$(call print_help,'bot','compile scrapper bot')
	@$(call print_help,'bot_clean','clean scrapper bot')
	@$(call print_help,'clean','clean all')
	@$(call print_help,'test [test_suite=<testname>]','compile and run test')
	@$(call print_help,'test_clean','clean test')

.PHONY: test